
<html>

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <script src="../../js/vue.js"></script>
    <link rel="stylesheet" href="../../element-ui/lib/theme-chalk/index.css">
    <link rel="stylesheet" href="../../plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../../plugins/ionicons/css/ionicons.min.css">
    <link rel="stylesheet" href="../../plugins/iCheck/square/blue.css">
    <link rel="stylesheet" href="../../plugins/morris/morris.css">
    <link rel="stylesheet" href="../../plugins/jvectormap/jquery-jvectormap-1.2.2.css">
    <link rel="stylesheet" href="../../plugins/datepicker/datepicker3.css">
    <link rel="stylesheet" href="../../plugins/daterangepicker/daterangepicker.css">
    <link rel="stylesheet" href="../../plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
    <link rel="stylesheet" href="../../plugins/datatables/dataTables.bootstrap.css">
    <link rel="stylesheet" href="../../plugins/treeTable/jquery.treetable.css">
    <link rel="stylesheet" href="../../plugins/treeTable/jquery.treetable.theme.default.css">
    <link rel="stylesheet" href="../../plugins/select2/select2.css">
    <link rel="stylesheet" href="../../plugins/colorpicker/bootstrap-colorpicker.min.css">
    <link rel="stylesheet" href="../../plugins/bootstrap-markdown/css/bootstrap-markdown.min.css">
    <link rel="stylesheet" href="../../plugins/adminLTE/css/AdminLTE.css">
    <link rel="stylesheet" href="../../plugins/adminLTE/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="../../css/style.css">
    <link rel="stylesheet" href="../../plugins/ionslider/ion.rangeSlider.css">
    <link rel="stylesheet" href="../../plugins/ionslider/ion.rangeSlider.skinNice.css">
    <link rel="stylesheet" href="../../plugins/bootstrap-slider/slider.css">
    <link rel="stylesheet" href="../../plugins/bootstrap-datetimepicker/bootstrap-datetimepicker.css">

    <script src="../../element-ui/lib/index.js"></script>
    <script src="../../js/axios-0.18.0.js"></script>

</head>
<style>

</style>

<body>

<div id="app">
    <el-button type="primary" round v-on:click="agree(0)" style="float: right">一键通过</el-button>
    <br>
    <table id="dataList" class="table table-bordered table-striped table-hover dataTable    ">
        <thead>
        <tr>
            <th class="text-center sorting">姓名</th>
            <th class="text-center sorting">用户名</th>
            <th class="text-center sorting">邮箱</th>
            <th class="text-center sorting">电话</th>
            <th class="text-center sorting">操作</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="(user,index) in users"  v-if="user.status==0">
            <td class="text-center sorting">{{user.name}}</td>
            <td class="text-center sorting">{{user.username}}</td>
            <td class="text-center sorting">{{user.email}}</td>
            <td class="text-center sorting">{{user.phone}}</td>
            <td class="text-center sorting"><el-button round type="primary" v-on:click="agree(user.aid)">通过</el-button><el-button round v-on:click="turnDown(user.aid)" type="danger">驳回</el-button></td>
        </tr>
        </tbody>
    </table>
    <!--    class="pageList"-->



</div>

</body>

<script>
    new Vue({
        el: '#app',
        data() {
            return {
                users:[],

            }
        },
        computed: {},
        created() {
            this.init()
            //this.user = JSON.parse(localStorage.getItem('userInfo')).username
        },
        mounted(){
            this.aa()
        },
        methods: {
            aa(){
                var _this=this;
                axios({
                          method:"get",
                          url:"http://localhost:8080/web/admin/examineUser"
                      }).then(function(resp){
                    _this.users=resp.data;
                })
            },
            agree(aid){
                var _this=this;
                axios({
                    method: 'post',
                    url: "http://localhost:8080/web/admin/agreeUser?aid="+aid
                }).then(function (resp){
                    var a = resp.data;
                    if (a==1){
                        _this.$message.success('审核通过！')
                        _this.aa()
                    }else{
                        _this.$message.error('未知原因审核失败，请联系管理员！')
                    }
                })
            },
            turnDown(aid){
                var _this=this;
                axios({
                    method:"post",
                    url:"http://localhost:8080/web/admin/deleteUser?aid="+aid
                }).then(function (resp){
                    var i=resp.data;
                    if (i==1){
                        _this.$message.success('驳回成功！')
                        _this.aa()
                    }else{
                        _this.$message.success('驳回失败！')
                        _this.aa()
                    }
                })
            }

        }
    })
</script>


</html>